<?php
namespace ChannelThrift\Service;

use Base\BaseService;

class AutoBiddingService extends BaseService {
    Protected $autoCheckFields = false;
    public  $connection = 'DB_AUMS';
    public $tablePrefix = 'au_';

    /**
     * 设置新的智能出价
     * @param $name
     * @return bool|mixed
     */
    public function insertIntelBid($data)
    {
        if(empty($data)){
           return false;
        }
        $data['createtime'] = date('Y-m-d H:i:s');
        $res =  D("ChannelThrift/Aums/AutoBidding")->add($data);
        return $res;
    }

    /**
     * 获取最后一次设置（停止）信息
     * @param $order_id
     * @param int $status
     * @return mixed
     */
    public function getLastAutoBiddingInfo($dealer_id,$order_id){
        return D("ChannelThrift/Aums/AutoBidding")->where(array('order_id'=>$order_id,'dealer_id'=>$dealer_id))->order("ab_id DESC")->find();
    }

}
